package LW.org.daoImple;

import LW.org.dao.BaseDao;
import LW.org.dao.userDao;
import LW.org.model.Admin;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import java.util.List;


public class userDaoImple extends BaseDao implements userDao {

    @Override
    public Admin select(int id) {

        Session session = getSession();
        Query query = session.createQuery("from Admin o where o.id=:id");
        query.setParameter("id",id);
        List<Admin> admin = query.list();
        if(admin.size()>0)
        {
            return admin.get(0);
        }
        return null;
    }
}
